import React, { Component } from 'react';
import {
  StyleSheet,
  View,
  Text,
  Image,
   FlatList,
   TouchableHighlight,
  Dimensions,
  TouchableOpacity,
} from 'react-native';

const { width, height } = Dimensions.get('window');

const leftwidth=width/5
const rightwidth=width*4/5
const imgwidth=width*4/25
const rightwidth1=width*16/25




var styles=StyleSheet.create({
 
   types:{
     width:'100%',
     height:70,
     flexDirection:'column',
     justifyContent:'center',
     backgroundColor:'white'
   },
   types1:{
     width:'100%',
     height:70,
     color:'white',
     backgroundColor:'#1296db',
     flexDirection:'column',
     justifyContent:'center',
   },
   typetext:{
     textAlign:'center',
   },
})




export default class Leftlist extends Component {
    constructor(props) {
    super(props);
   
    }

    shouldComponentUpdate(nextProps, nextState) {
        return true
      }

    render(){
        return (
        <TouchableHighlight
                  activeOpacity={0.5}
                  underlayColor={'red'}
                   style={this.props.num==this.props.data.index?styles.types1:styles.types}
                   onPress={()=>{
                     this.props.chose(this.props.data.index)
                   }}
                   >
                  <Text style={styles.typetext}>
                  {this.props.data.item.name}
                  </Text>
                  </TouchableHighlight>
                  )
    }
}